var Mock = require("mockjs");

// 假数据添加
var ly = Mock.mock({
  "data|20": [
    {
      //市
      ccity: "@city",
      //商品售价   (开店数量)
      "goodsSale|1-20": 1,
      //商品等级评价★
      "goodsStar|1-5": "★",
    },
  ],
});

class delMsg {
  getDate() {
    // 获取数据
    return Promise.resolve(ly);
  }
  addDate(payload) {
    // 新增数据 payload是对象
    ly.data.push(payload);
    return Promise.resolve(ly);
  }
  searchData(payload) {
    const res = ly.data.filter((item) => item.ccity === payload);
    return Promise.resolve(res);
  }
}

const chooseCity = new delMsg();

export default chooseCity;
